'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);
  // router.resources("user","/user",controller.user);

  // login
  router.post("/login",controller.login.login);
  router.get("/getInfo",controller.login.getInfo);
  router.post("/logout",controller.login.logout);
  router.get("/captchaImage",controller.login.getCodeImg);
  router.post("/register/auth",controller.login.register);
  router.get("/getRouters",controller.login.getRouter);

  // sys_user
  router.get("/system/user/list",controller.user.index);
  router.get("/system/user/",controller.user.getOption);
  router.post("/system/user",controller.user.create);
  router.get("/system/user/:id",controller.user.show);
  router.put("/system/user/changeStatus",controller.user.changeStatus);
  router.put("/system/user/resetPwd",controller.user.restePsd);
  router.put("/system/user",controller.user.update);
  router.delete("/system/user/:id",controller.user.destroy);

  // sys_dict_type
  router.get("/system/dict/type/list",controller.dictType.index);
  router.get("/system/dict/type/:id",controller.dictType.show);
  router.put("/system/dict/type",controller.dictType.update);
  router.post("/system/dict/type",controller.dictType.create);
  router.delete("/system/dict/type/clearCache",controller.dictType.clearCache);
  router.delete("/system/dict/type/:id",controller.dictType.destroy);

  // sys_dict_data
  router.get("/system/dict/data/list",controller.dictData.index);
  router.get("/system/dict/data/:id",controller.dictData.show);
  router.get("/system/dict/data/type/:id",controller.dictData.findByType);
  router.post("/system/dict/data",controller.dictData.create);
  router.put("/system/dict/data",controller.dictData.update);
  router.delete("/system/dict/data/:id",controller.dictData.destroy);

  // sys_menu
  router.get("/system/menu/list",controller.menu.index);
  router.get("/system/menu/treeselect",controller.menu.treeselect);
  router.get("/system/menu/roleMenuTreeselect/:id",controller.menu.getMenuByRole);
  router.put("/system/menu",controller.menu.update);
  router.post("/system/menu",controller.menu.create);
  router.get("/system/menu/:id",controller.menu.show);
  router.delete("/system/menu/:id",controller.menu.destroy);

  // sys_role
  router.get("/system/role/list",controller.role.index);
  router.put("/system/role/changeStatus",controller.role.changeStatus);
  router.put("/system/role/dataScope",controller.role.dataScope)
  router.get("/system/role/:id",controller.role.show);
  router.put("/system/role",controller.role.update);
  router.post("/system/role",controller.role.create);
  router.delete("/system/role/:id",controller.role.destroy);

  // sys_dept
  router.get("/system/dept/roleDeptTreeselect/:id",controller.dept.roleDeptTreeselect);
  router.get("/system/dept/list/exclude/:id",controller.dept.exclude);
  router.get("/system/dept/treeselect",controller.dept.treeselect);
  router.get("/system/dept/list",controller.dept.index);
  router.post("/system/dept",controller.dept.create);
  router.get("/system/dept/:id",controller.dept.show);
  router.put("/system/dept",controller.dept.update);
  router.delete("/system/dept/:id",controller.dept.destroy);

  // sys_post
  router.get("/system/post/list",controller.post.index);
  router.get("/system/post/:id",controller.post.show);
  router.post("/system/post",controller.post.create);
  router.put("/system/post",controller.post.update);
  router.delete("/system/post/:id",controller.post.destory);

  // sys_config
  router.get("/system/config/list",controller.config.index);
  router.get("/system/config/configKey/:key",controller.config.getConfigByKey);
  router.get("/system/config/:id",controller.config.show);
  router.put("/system/config",controller.config.update);
  router.post("/system/config",controller.config.create);
  router.delete("/system/config/:id",controller.config.destroy);



  router.get("/games/games/wx/findOpenId",controller.yxcg.findOpenId);
  router.get("/games/games/gameTitle/treeselect",controller.yxcg.getByParent);
  router.get("/games/games/gameTitle/selectModuleList",controller.yxcg.getQuestion);
  router.post("/games/games/addscore",controller.yxcg.addscore);
  router.get("/games/games/getscorelist",controller.yxcg.getscore);

};
